package com.kyivmohyla.kma2.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.google.inject.Inject;
import com.kyivmohyla.kma2.client.presenter.LoginViewPresenter;

public class LoginView extends Composite implements LoginViewPresenter.Display {
    private static LoginViewUiBinder ourUiBinder = GWT.create(LoginViewUiBinder.class);
    @UiField
    protected TextBox login;
    @UiField
    protected PasswordTextBox password;
    @UiField
    protected Button commit;
    @UiField
    protected Button passwordResetButton;

    @Inject
    public LoginView() {
        initWidget(ourUiBinder.createAndBindUi(this));
    }

    @Override
    public HasClickHandlers getLoginButton() {
        return commit;
    }

    @Override
    public HasClickHandlers getPasswordResetButton() {
        return passwordResetButton;
    }

    @Override
    public HasText getLogin() {
        return login;
    }

    @Override
    public HasText getPassword() {
        return password;
    }

    public Widget asWidget() {
        return this;
    }

    interface LoginViewUiBinder extends UiBinder<Widget, LoginView> {
    }
}
